package com.mdl.common.util.file;

import java.io.File;
import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * User: 刘天宇
 * Date: 2018/8/14
 * Time: 21:05
 * Description:
 */
public class FileUtil {
    private FileUtil(){}

    /**
     * 创建文件夹
     * @param path
     */
    public static void makeDir(String path) {
        File dirFile = new File(path);
        if(!dirFile.exists()) {
            dirFile.mkdirs();
        }
    }

    /**
     * 创建文件
     * @param path
     * @param fileName
     * @return
     */
    public static File createFile(String path, String fileName) {
        File file = new File(path + fileName);
        if(!file.exists()) {
            try {
                file.createNewFile();
            } catch (IOException e) {
                e.printStackTrace();
                return null;
            }
        }
        return file;
    }

}
